package com.hznu.jspFinal.service;

import com.hznu.jspFinal.dao.ClassMapper;
import com.hznu.jspFinal.entity.Class;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 班级
 * @author jamesZhan
 */
@Service
public class ClassServiceImpl implements ClassService{
    @Autowired
    private ClassMapper classMapper;

    @Override
    public void insert(Class clazz) {
        classMapper.insert(clazz);
    }

    @Override
    public void delete(Integer id) {
        classMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(Class clazz) {
        classMapper.updateByPrimaryKeySelective(clazz);
    }

    @Override
    public Class selectByPrimaryKey(Integer id) {
        return classMapper.selectByPrimaryKey(id);
    }

    @Override
    public Class selectByClassName(String name) {
        return classMapper.selectByClassName(name);
    }

    @Override
    public List<Class> selectByMajorId(Integer majorid) {
        return classMapper.selectByMajorId(majorid);
    }
}
